package net.jam.loader;

import java.applet.AppletContext;
import java.applet.AppletStub;
import java.net.URL;
import java.util.HashMap;

public class ClientStub implements AppletStub {

	private Boolean isActive = true;
	private URL codeBase;
	private URL documentBase;
	private HashMap<String, String> params;

	public ClientStub(String codeBase, String documentBase,
			HashMap<String, String> params) {
		try {
			this.codeBase = new URL(codeBase);
			this.documentBase = new URL(documentBase);
			this.params = params;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void setActive(Boolean active) {
		this.isActive = active;
	}

	@Override
	public void appletResize(int width, int height) {

	}

	@Override
	public AppletContext getAppletContext() {
		return null;
	}

	@Override
	public final URL getCodeBase() {
		return codeBase;
	}

	@Override
	public final URL getDocumentBase() {
		return documentBase;
	}

	@Override
	public String getParameter(String name) {
		return params.get(name);
	}

	@Override
	public boolean isActive() {
		return isActive;
	}

}
